package ar.edu.utn.frsf.cidisi.upcolbpip2pn.generator.petrinet;

public class Place {
	
	public static String PORT_TYPE_IN = "In";
	public static String PORT_TYPE_OUT = "Out";
	
	private static int GlobalPlaceId = 100001;
	private static int GlobalMarkId = 110001;
	private static int GlobalTypeId = 120001;
	private static int GlobalPortId = 130001;
	private static int GlobalFusionId = 140001;
	
	private String id;
	private int posX;
	private int posY;
	private String text;
	private String dataType;
	private String typeId;
	private String markId;
	private String portId;
	private String portType;
	private String fusionId;
	private boolean initialMarking;
	
	public Place(String text){
		GlobalPlaceId++;
		GlobalTypeId++;
		GlobalMarkId++;
		
		id = "ID"+GlobalPlaceId;
		typeId = "ID"+GlobalTypeId;
		markId = "ID"+GlobalMarkId;
		dataType = "MSG";
//		this.text = text+GlobalPlaceId;
		this.text = "p"+GlobalPlaceId;
		
		portId = null;
		portType = null;
		fusionId = null;
		initialMarking = false;
		
		
	}

	public Place(String text, boolean fusion){
		this(text);
		
		if (fusion){
			GlobalFusionId++;
			fusionId = "ID"+GlobalFusionId;
		}
		
	}

	public Place(String text, String portType){
		this(text);

		GlobalPortId++;
		portId = "ID"+GlobalPortId;
		this.portType = portType;
	}

	public String getFusionId() {
		return fusionId;
	}

	public Place(String text, String portType, String placeId){
		GlobalTypeId++;
		GlobalMarkId++;
		
		id = placeId;
		typeId = "ID"+GlobalTypeId;
		markId = "ID"+GlobalMarkId;
		dataType = "MSG";
//		this.text = text+GlobalPlaceId;
		this.text = "p"+GlobalPlaceId;
		
		GlobalPortId++;
		portId = "ID"+GlobalPortId;
		this.portType = portType;
	}
	
	public static void reset(){
		GlobalPlaceId = 100001;
		GlobalMarkId = 110001;
		GlobalTypeId = 120001;
		GlobalPortId = 130001;
		GlobalFusionId = 140001;
	}
	
	public String getType() {
		return dataType;
	}

	public void setType(String type) {
		this.dataType = type;
	}
	
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public int getPosX() {
		return posX;
	}
	public void setPosX(int posX) {
		this.posX = posX;
	}
	public int getPosY() {
		return posY;
	}
	public void setPosY(int posY) {
		this.posY = posY;
	}
	public String getText() {
		return text;
	}
	public void setText(String text) {
		this.text = text;
	}

	public String getTypeId() {
		return typeId;
	}

	public void setTypeId(String typeId) {
		this.typeId = typeId;
	}

	public String getMarkId() {
		return markId;
	}

	public void setMarkId(String initMarkId) {
		this.markId = initMarkId;
	}

	public String getPortId() {
		return portId;
	}

	public void setPortId(String portId) {
		this.portId = portId;
	}

	public String getPortType() {
		return portType;
	}

	public void setPortType(String portType) {
		this.portType = portType;
	}

	public String getDataType() {
		return dataType;
	}

	public void setDataType(String dataType) {
		this.dataType = dataType;
	}

	public void setFusionId(String fusionId) {
		this.fusionId = fusionId;
	}

	public boolean isInitialMarking() {
		return initialMarking;
	}

	public void setInitialMarking(boolean initialMarking) {
		this.initialMarking = initialMarking;
	}

	
}
